# -*- coding: UTF-8 -*-
'''
Created on 25.02.2013

@author: Peter He�
'''
import unittest
from Value import WaveShaper 

class Test(unittest.TestCase):

    def feq(self,a,b):
        if abs(a-b)<0.0001:
            return True
        else:
            return False

    def setUp(self):
        pass


    def tearDown(self):
        pass


    def testName(self):
        spread = [.0, .1, .2, .3, .4, .5, .6, .7, .8, .9]
        expected = [1.0000, 0.9045, 0.6545, 0.3455, 0.0955, 0.0000, 0.0955, 0.3455, 0.6545, 0.9045]
        ws = WaveShaper()
        ws.update(Input_in = spread)
        self.assertIs(10, len(ws.Output))
        for i in range(10):
            # print str(expected[i]) + " " + str(spread[i])
            self.assertTrue( self.feq(expected[i], ws.Output[i]), "i=" + str(i))
        pass


if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testName']
    unittest.main()